public class Test {
    public static void main(String[] args) {
        int arr[]={31,45,34,52,1423,523,63,41};
        A.sort(arr);
        for(int data:arr){
            System.out.print(data+" ");
        }
    }
}

class A{
    public  static void sort(int arr[]){
        for(int i=0;i<arr.length-1;i++){
            int min=arr[i];
            int index=i;
            for(int j=i+1;j<arr.length;j++){
                if(arr[j]<min){
                    min=arr[j];
                    index=j;
                }
                if(index!=i){
                    arr[index]=arr[i];
                    arr[i]=min;
                }
            }
        }
    }
}